<template>
  <view class="ikz-apply">
    <ikz-loading :css-data="loading_css" ></ikz-loading>
    <ikz-head :show-data="user_all_info" :user-info="user_info" status="2"></ikz-head>
    <view class="ikz-home-list">
      <view class="ikz-home-box">
        <view class="ikz-home-title">订单数据</view>
        <view class="ikz-home-item-box">
          <view class="ikz-home-item"
            :style="'background-image: url('+adminFontPath+'/assets/addons/xyb/img/ordering.png);background-repeat:no-repeat;background-size:100% 150rpx;'"  @click="orderList(2)">
            <view class="ikz-home-item-title">
              进行中订单
            </view>
            <view class="ikz-home-item-num">
              {{user_all_info.in_progress_order_count}}
            </view>
          </view>
          <view class="ikz-home-item"
            :style="'background-image: url('+adminFontPath+'/assets/addons/xyb/img/orderover.png);background-repeat:no-repeat;background-size:100% 150rpx;'"  @click="orderList(3)">
            <view class="ikz-home-item-title">
              已完成订单
            </view>
            <view class="ikz-home-item-num">
              {{user_all_info.finish_order_count}}
            </view>
          </view>
        </view>

      </view>
    </view>
    <view class="ikz-home-list">
      <view class="ikz-home-box">
        <view class="ikz-home-title">统计数据</view>
        <view class="ikz-stat-box">
          <ikz-statistics :show-data="user_all_info"  status="2"></ikz-statistics>
        </view>
      </view>
    </view>
    <view class="ikz-home-bottom">
      <view class="ikz-home-bottom-box" @click="orderList(1)">
        <image class="ikz-home-bottom-box-img" src="/static/receiver/orderReceiving.png"></image>
        <view class="ikz-home-bottom-box-title">
          接单大厅
        </view>
      </view>
    </view>
  </view>
</template>

<script>
  import ikzLoading from '@/pages/Component/Public/Loading/loading.vue';
  import ikzHead from '@/pages/Component/Public/Receiverhead/public/login/login.vue';
  import ikzStatistics from '@/pages/Component/Public/Statistics/public/statistics/index.vue';
  var app = getApp();
  import ikz from '@/pages/Common/tools.js';
  export default {
    components: {
      ikzLoading,
      ikzHead,
      ikzStatistics
    },
    data() {
      return {
        adminFontPath:app.globalData.adminFontPath,
        form_data: {
          name: '',
          student_no: '',
          student_positive_image: '',
          code_image: '',
        },
        files: [],
        loading_css: {
          display: 'flex',
        },
        user_all_info:{},
		user_info:{}
      }
    },
    onShow(){
      this.userInfo((res)=>{
        this.loading_css.display = 'none';
      })
	  this.getUpdate()
    },
    onPullDownRefresh() {
      this.userInfo((res)=>{
        uni.stopPullDownRefresh();
      });
    },
    created() {
      // var that = this; 
    },
    methods: {
      userInfo(fn) {
        var path = '/xyb/user_receive/center';
        var data = {};
        ikz.post(path, data, res => {
          if (res.data.code) {
            this.user_all_info = res.data.data;
          }else{
            uni.showModal({
              title: '提示',
              content: res.data.msg,
              showCancel: false,
              success: function(res) {}
            });
          }
          fn();
          uni.hideLoading();
          // if(that.pull_status){ 
          // 	this.$emit("change",'pull');
          // }
        });
      },
	  //获取头像和名称 
	  	getUpdate() {
	  		var path = '/xyb/user/baseinfo';
	  		var data = {
				token: uni.getStorageSync('local_user_session'),
				app_plat: "MP-WEIXIN"
			};
	  		ikz.get(path, data, res => {
	  			if (res.data.code) {
					this.user_info = res.data.data.user_info;
	  			} 
				
	  		});
	  	},	
      orderList(status){
        uni.navigateTo({
          url:'../../order/index/index?status='+status
        })
      },
    }
  };
</script>

<style>
  page {
    width: 100%;
    height: 100%;
    background: #F3F3F3;
    position: relative;
  }

  .ikz-home-list {
    box-sizing: border-box;
    padding: 10rpx 0px;
    margin-top: -10rpx;
    border-top-right-radius: 15rpx;
    border-top-left-radius: 15rpx;
    background: #F3F3F3;
  }

  .ikz-home-title {
    position: relative;
    box-sizing: border-box;
    width: 100%;
    padding: 0px 0rpx 20px 10px;
    font-weight: 800;
  }

  .ikz-home-title:before {
    content: " ";
    display: inline-block;
    height: 40rpx;
    width: 10rpx;
    background: #FBAB7E;
    border-radius: 15rpx;
    position: absolute;
    left: 0px;
    top: 0px
  }

  .ikz-home-box {
    box-sizing: border-box;
    padding: 30rpx 0px 30rpx;
    width: 95%;
    margin: 0px auto 0px;
    border-radius: 15rpx;
    overflow: hidden;
  }

  .ikz-home-item-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .ikz-home-item {
    box-sizing: border-box;
    padding-left: 20rpx;
    width: 48%;
    height: 150rpx;
    color: #fff;
    line-height: 75rpx;
  }

  .ikz-stat-box {
    border-radius: 15rpx;
    overflow: hidden;
  }
  
  .ikz-home-bottom{
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .ikz-home-bottom-box{
    width: 300rpx;
    height: 300rpx;
    background: linear-gradient(to right, #F8C66D, #FBAB7E);
    border-radius: 50%;
    color: #fff;
    display: flex;
     flex-direction: row;
     align-content:center;
     justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 20rpx;
  }
  .ikz-home-bottom-box-img{
    width: 120rpx;
    height: 120rpx;
  }
  .ikz-home-bottom-box-title{
    width: 100%;
    text-align: center;
    font-size: 40rpx;
  }
</style>
